<%@ page language="java" contentType="text/html; charset=UTF-8" 
 pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ include file="index.jsp"  %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta charset="utf-8">
</head>
<body>

<!--_表格--开始-->
<section class="Hui-article-box">
    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
        <span class="c-gray en">&gt;</span>
        商品管理
        <span class="c-gray en">&gt;</span>
        租赁商品管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href)" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a> </nav>
    <div class="Hui-article">
        <article class="cl pd-20">    	
            
            <div class="cl pd-5 bg-1 bk-gray mt-20">
            	<shiro:hasPermission name="commodity">
                <span class="l">
	                <a href="leaseitem-add" class="btn btn-primary radius">
	                	<i class="Hui-iconfont">&#xe600;</i> 添加商品
	                </a> 
                </span>
                </shiro:hasPermission>
                <span class="r">共有数据：<strong>${page.total}</strong> 条</span>
            </div>
            <table class="table table-border table-bordered table-bg">
                <thead>
                <tr>
                    <th scope="col" colspan="13">租赁列表</th>
                </tr>
                <tr class="text-c">
                    <th width="40">ID</th>
                    <th width="90">套餐名</th>
                    <th width="150">品牌</th>
                    <th width="150">CPU</th>
                    <th width="100">内存</th>
                    <th width="100">显卡</th>
                    <th width="100">硬盘</th>
                    <th width="100">不足一个月</th>
                    <th width="100">不足三个月</th>
                    <th width="100">超过三个月</th>
  					<th width="100">押金</th>
  					<th width="100">折扣</th>
  					<shiro:hasPermission name="commodity">
                    <th width="100">操作</th>
                    </shiro:hasPermission>
                </tr>
                </thead>
                <tbody>
                	<c:forEach begin="0" step="1" items="${page.list}" var="list"
					varStatus="userlist">
		                <tr class="text-c">		
		                    <td>${userlist.count}</td>
		                    <td>${list.combo_name }</td>
		                    <td>${list.brand }</td>
		                    <td>${list.cpu }</td>
		                    <td>${list.neicuen }</td>
		                    <td>${list.xianka }</td>
		                    <td>${list.yingpan }</td>
		                    <td>${list.oneday }元</td>
		                    <td>${list.onemonth }元</td>
		                    <td>${list.threemonth }元</td>
		                    <td>${list.yajin }元</td>
		                    <td>${list.zheko}</td>
		                    <shiro:hasPermission name="commodity">
		                    <td class="td-manage">
		                    	<a title="编辑" href="leaseitem-edit?rid=${list.rid }" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a> 
		                    	<a title="删除" href="javascript:;" onclick="admin_del(this,'${list.rid }')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>
		                    </td>
		                    </shiro:hasPermission>
		                </tr>
                	</c:forEach>
                </tbody>
                <thead>
	                	<tr>
	                		<th colspan="13"><p>第${page.pageNum}页 共${page.pages}页</p>
							    <a href="content-1_3?pageNum=1">首页</a>
									<c:choose>
										<c:when test="${page.pageNum==1||page.pageNum==0 }">
							    			<a href="#">上一页</a>
										</c:when>
										<c:otherwise>
											<a href="content-1_3?pageNum=${page.prePage}">上一页</a>
										</c:otherwise>
									</c:choose>
									<c:choose>
										<c:when test="${page.pageNum==page.pages }">
							    			<a href="#">下一页</a>
										</c:when>
										<c:otherwise>
											<a href="content-1_3?pageNum=${page.nextPage}">下一页</a>
										</c:otherwise>
									</c:choose>	 	
							    <a href="content-1_3?pageNum=${page.pages}">尾页</a>
	    					</th>
	                	</tr>               	
                </thead>
            </table>
        </article>
    </div>
</section>

<!--_表格--结束-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
    $('.table-sort').dataTable({
        "aaSorting": [[ 1, "desc" ]],//默认第几个排序
        "bStateSave": true,//状态保存
        "aoColumnDefs": [
            //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
            {"orderable":false,"aTargets":[0,8]}// 不参与排序的列
        ]
    });
    
   /*商品-删除*/
    function admin_del(obj,id){
        layer.confirm('确认要删除吗？',{ btn: ["确定","取消"] },function(index){
            $.ajax({
                type: 'POST',
                url: 'deleleaseitem',
                data:{rid:id},
                dataType: 'json',
                success: function(val){
                	layer.close(index);
                	window.location.href = window.location.href;                	
                },
                error:function(data) {
                    console.log(data.msg);
                },
            });
        });
    }
    
    function brandyz(id){
    	var v=$("#"+id).val();
    	if(v.indexOf('"')==0){
    		$("#"+id).val(null)
    		alert('输入不能包含"！');
    	}
    }

</script>
</body>
</html>